package com.xjscrm.console.web.circle;


import com.xjscrm.common.exception.BusinessException;
import com.xjscrm.console.common.util.LoginContext;
import com.xjscrm.console.dto.circle.CircleTaskPublishDTO;
import com.xjscrm.console.service.customer.circle.CircleTaskPublishService;
import com.xjscrm.console.vo.CircleTaskPublishVO;
import com.xjscrm.console.vo.LoginVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Objects;

/**
 * 朋友圈发布记录(CircleTaskPublish)表控制层
 *
 * @author szl
 * @since 2024-04-09 10:27:53
 */
@RestController
@RequestMapping("/circleTaskPublish")
@Api(tags = "朋友圈发布记录控制器")
public class CircleTaskPublishController {
    /**
     * 服务对象
     */
    @Autowired
    private CircleTaskPublishService circleTaskPublishService;

    /**
     * 分页查询所有数据
     *
     * @param source 查询实体
     * @return 所有数据
     */
    @PostMapping("/search")
    @ApiOperation(value = "朋友圈发布记录分页查询", response = CircleTaskPublishVO.class)
    public Object search(@RequestBody CircleTaskPublishDTO source) {
        if (Objects.isNull(source) || Objects.isNull(source.getTaskId())) {
            throw new BusinessException("参数错误");
        }
        LoginVO login = LoginContext.getLogin();

        return circleTaskPublishService.search(login.getMerId(), login.getId(), source);
    }
}

